<ClinicalDocument xmlns="urn:hl7-org:v3" xmlns:mif="urn:hl7-org:v3/mif"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="urn:hl7-org:v3 ..\sdschemas\CDA.xsd">
    <#assign templateData={"title":"死亡医学证明", "code":"HSDB03.03", "templateId":"2.16.156.10011.2.1.1.11"}>

    <realmCode code="CN"/>
    <typeId root="2.16.840.1.113883.1.3" extension="POCD_MT000040"/>
    <templateId root="2.16.156.10011.2.1.1.11" extension="DT2011001"/>
    <id root="2.16.156.10011.1.1.1.3" extension="${docData.id}"/>  <!--1-->
    <code code="HSDB03.03" codeSystem="2.16.156.10011.2.4" codeSystemName="卫生信息共享文档规范编码体系"/>
    <title>死亡医学证明</title>
    <effectiveTime value="${docData.effectiveTime}" xsi:type="TS"/>  <!--1-->
    <confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25" displayName="正常访问保密级别"
                         codeSystemName="Confidentiality"/>
    <languageCode code="zh-CN"/>
    <setId/>
    <versionNumber/>
    <recordTarget typeCode="RCT" contextControlCode="OP">
        <patientRole classCode="PAT">
            <id root="2.16.156.10011.1.2" extension="${docData.patientRole.id}"/>  <!--1-->
            <id root="2.16.156.10011.1.12" extension="${docData.patientRole.zhuYuanHBS}"/>
            <addr use="H">
                <#if docData.patientRole.addr.houseNumber??>
                    <houseNumber>${docData.patientRole.addr.houseNumber}</houseNumber>
                </#if>
                <#if docData.patientRole.addr.streetName??>
                    <streetName>${docData.patientRole.addr.streetName}</streetName>
                </#if>
                <#if docData.patientRole.addr.township??>
                    <township>${docData.patientRole.addr.township}</township>
                </#if>
                <#if docData.patientRole.addr.county??>
                    <county>${docData.patientRole.addr.county}</county>
                </#if>
                <#if docData.patientRole.addr.city??>
                    <city>${docData.patientRole.addr.city}</city>
                </#if>
                <#if docData.patientRole.addr.state??>
                    <state>${docData.patientRole.addr.state}</state>
                </#if>
                <#if docData.patientRole.addr.postalCode??>
                    <postalCode>${docData.patientRole.addr.postalCode}</postalCode>
                </#if>
            </addr>
            <patient classCode="PSN" determinerCode="INSTANCE">
                <#if docData.patientRole.patient.id??>
                    <id root="2.16.156.10011.1.3" extension="${docData.patientRole.patient.id}"/>
                </#if>
                <name>${docData.patientRole.patient.name}</name>
                <#if docData.patientRole.patient.administrativeGender??>
                    <administrativeGenderCode code="${docData.patientRole.patient.administrativeGender.code}"
                                              codeSystem="2.16.156.10011.2.3.3.4"
                                              displayName="${docData.patientRole.patient.administrativeGender.displayName}"
                                              codeSystemName="生理性别代码表(GB/T 2261.1)"/>
                </#if>
                <#if docData.patientRole.patient.birthTime??>
                    <birthTime value="${docData.patientRole.patient.birthTime}"/>
                </#if>
                <#if docData.patientRole.patient.maritalStatus??>
                    <maritalStatusCode code="${docData.patientRole.patient.maritalStatus.code}"
                                       codeSystem="2.16.156.10011.2.3.3.5"
                                       displayName="${docData.patientRole.patient.maritalStatus.displayName}"
                                       codeSystemName="婚姻状况代码表(GB/T 2261.2)"/>
                </#if>
                <#--                <ethnicGroupCode code="01" codeSystem="2.16.156.10011.2.3.3.3" displayName="汉族"-->
                <#--                                 codeSystemName="民族类别代码表(GB 3304)"/>-->
                <#if docData.patientRole.patient.employerOrganization??>
                    <employerOrganization>
                        <name>${docData.patientRole.patient.employerOrganization}</name>
                        <telecom value="${docData.patientRole.patient.telecom}"/>  <!--1-->
                    </employerOrganization>
                </#if>
                <#if docData.patientRole.patient.householdAddr??>
                    <household>
                        <place>
                            <addr>
                                <#if docData.patientRole.patient.householdAddr.houseNumber??>
                                    <houseNumber>${docData.patientRole.patient.householdAddr.houseNumber}</houseNumber>
                                </#if>
                                <#if docData.patientRole.patient.householdAddr.houseNumber??>
                                    <streetName>${docData.patientRole.patient.householdAddr.streetName}</streetName>
                                </#if>
                                <#if docData.patientRole.patient.householdAddr.houseNumber??>
                                    <township>${docData.patientRole.patient.householdAddr.township}</township>
                                </#if>
                                <#if docData.patientRole.patient.householdAddr.houseNumber??>
                                    <county>${docData.patientRole.patient.householdAddr.county}</county>
                                </#if>
                                <#if docData.patientRole.patient.householdAddr.houseNumber??>
                                    <city>${docData.patientRole.patient.householdAddr.city}</city>
                                </#if>
                                <#if docData.patientRole.patient.householdAddr.houseNumber??>
                                    <state>${docData.patientRole.patient.householdAddr.state}</state>
                                </#if>
                            </addr>
                        </place>
                    </household>
                </#if>
                <#if docData.patientRole.patient.educationLevel??>
                    <educationLevel>
                        <educationLevelCode code="${docData.patientRole.patient.educationLevel.code}"
                                            codeSystem="2.16.156.10011.2.3.3.6"
                                            displayName="${docData.patientRole.patient.educationLevel.displayName}"
                                            codeSystemName="学历代码表(GB/T 4658)"/>
                    </educationLevel>
                </#if>
                <#if docData.patientRole.patient.occupation??>
                    <occupation>
                        <occupationCode code="${docData.patientRole.patient.occupation.code}"
                                        codeSystem="2.16.156.10011.2.3.3.7"
                                        displayName="${docData.patientRole.patient.occupation.displayName}"
                                        codeSystemName="职业类别代码表(GB/T 6565)" codeSystemVersion="职业类别代码表（GB/T 6565）" />
                    </occupation>
                </#if>
            </patient>
        </patientRole>
    </recordTarget>
    <author typeCode="AUT" contextControlCode="OP">
        <time value="${docData.author.time}" xsi:type="TS"/>
        <assignedAuthor classCode="ASSIGNED">
            <id root="2.16.156.10011.1.7" extension="${docData.author.id}"/>
            <assignedPerson>
                <name>${docData.author.name}</name>
            </assignedPerson>
            <representedOrganization>
                <id root="2.16.156.10011.1.5" extension="${docData.author.organizationId}"/>
                <name>${docData.author.organizationName}</name>
                <addr/>
            </representedOrganization>
        </assignedAuthor>
    </author>
    <custodian typeCode="CST">
        <assignedCustodian classCode="ASSIGNED">
            <representedCustodianOrganization classCode="ORG" determinerCode="INSTANCE">
                <id root="2.16.156.10011.1.6" extension="${docData.custodian.id}"/>
                <name>${docData.custodian.name}</name>
                <#if docData.custodian.telecom??>
                    <telecom value="${docData.custodian.telecom}"/>
                </#if>
                <#if docData.custodian.addr??>
                    <addr>${docData.custodian.addr}</addr>
                <#else>
                    <addr/>
                </#if>
            </representedCustodianOrganization>
        </assignedCustodian>
    </custodian>
    <#if docData.participant??>
        <participant typeCode="NOT">
            <associatedEntity classCode="ECON">
                <#if docData.participant.telecom??>
                    <telecom value="${docData.participant.telecom}"/>
                </#if>
                <#if docData.participant.name??>
                    <associatedPerson>
                        <name>${docData.participant.name}</name>
                    </associatedPerson>
                </#if>
            </associatedEntity>
        </participant>
    </#if>
    <!-- 文档体章节 -->
    <component>
        <structuredBody>
            <component>
                <section>
                    <code displayName="死亡信息" />
                    <text/>
                    <entry>
                        <observation moodCode="EVN" classCode="OBS">
                            <code code="DE02.01.036.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="死亡日期" />
                            <value value="${docData.siWangRQ}" xsi:type="TS"/>
                        </observation>
                    </entry>
                    <entry>
                        <observation moodCode="EVN" classCode="OBS">
                            <code code="DE02.01.034.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="死亡地点"/>
                            <value code="${docData.siWangDD.code}" xsi:type="CD" codeSystem="2.16.156.10011.2.3.1.3"
                                   displayName="${docData.siWangDD.displayName}" codeSystemName="死亡地点类别代码表"/>
                        </observation>
                    </entry>
                    <entry>
                        <observation moodCode="EVN" classCode="OBS">
                            <code code="DE08.10.013.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="死亡医院"/>
                            <value xsi:type="ST">${docData.siWangDDMC}</value>   <!--1-->
                        </observation>
                    </entry>
                </section>
            </component>
            <!-- 诊断记录章节 -->
            <component>
                <section>
                    <code code="29548-5" codeSystem="2.16.840.1.113883.6.1" displayName="Diagnosis" codeSystemName="LOINC" />
                    <text/>
                    <#if docData.siWangYYList??>
                        <#list docData.siWangYYList as item>
                            <entry>
                                <observation moodCode="EVN" classCode="OBS">   <!--1-->
                                    <code code="DE05.01.061.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录"  displayName="死亡原因"/>
                                    <value code="${item.codeObject.code}" xsi:type="CD"  codeSystem="2.16.156.10011.2.3.3.11" displayName="${item.codeObject.displayName}" codeSystemName="ICD-10" />
<#--                                    <value @xsi:type="ST" />-->
                                </observation>
                            </entry>
                        </#list>
                    </#if>
                    <#if docData.faBingSWSJ??>
                        <#list docData.faBingSWSJ as item>
                            <entry>
                                <observation moodCode="EVN" classCode="OBS">
                                    <code code="DE06.00.023.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="发病到死亡时长" />
                                    <value xsi:type="ST">${item}</value>
                                </observation>
                            </entry>
                        </#list>
                    </#if>
                    <#if docData.qiTaJBZDList ??>
                        <#list docData.qiTaJBZDList as item>
                            <entry>
                                <observation moodCode="EVN" classCode="OBS">
                                    <code code="DE05.01.032.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="疾病的诊断状态类型"/>
                                    <value code="${item.code}" xsi:type="CD" codeSystem="2.16.156.10011.2.3.3.11" displayName="${item.displayName}" codeSystemName="ICD-10" />
                                </observation>
                            </entry>
                        </#list>
                    </#if>

                    <entry>
                        <observation moodCode="EVN" classCode="OBS">   <!--1-->
                            <code code="DE08.10.049.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录"  displayName="最高诊断机构级别"/>
                            <value code="${docData.zuiGaoZDDWDM}" xsi:type="CD" codeSystem="2.16.156.10011.2.3.1.202" displayName="${docData.zuiGaoZDDWMC}" codeSystemName="最高诊断机构级别代码表"/>
                        </observation>
                    </entry>
                    <entry>
                        <observation moodCode="EVN" classCode="OBS">   <!--1-->
                            <code code="DE05.01.043.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="上述疾病的最好诊断依据"/>
                            <value code="${docData.zuiGaoZDYJ.code}" xsi:type="CD" codeSystem="2.16.156.10011.2.3.1.136" displayName="${docData.zuiGaoZDYJ.displayName}" codeSystemName="死亡最高诊断依据类别代码表"/>
                        </observation>
                    </entry>
                    <entry>
                        <observation moodCode="EVN" classCode="OBS">  <!--1-->
                            <code code="DE05.01.021.00" codeSystem="2.16.156.10011.2.2.1" codeSystemName="卫生信息数据元目录" displayName="根本死亡原因代码" />
                            <value code="${docData.genBenSY.code}" xsi:type="CD" codeSystem="2.16.156.10011.2.3.3.11" displayName="${docData.genBenSY.displayName}" codeSystemName="ICD-10"/>
                        </observation>
                    </entry>
                </section>
            </component>
        </structuredBody>
    </component>
</ClinicalDocument>